package main

import (
	"fmt"
	"os"
	"time"

	"gitee.com/dark.H/go-utils/s"
)

var (
	w  = `this is a str test !!!!`
	w2 = `hell otis "sdsfd" asdfdsagdsa`
	w3 = "` asdfhaewg \" asdf 'fasfs `   asdfd"
)

func main() {

	s.Str(" hello ").ANSIStyle(s.FgGreen, s.ANSI_STYLE_UNDERLINE).ANSISelected().Println()
	raw := s.Str("@ex.go").ParseFileContent()
	u, _ := os.UserHomeDir()
	fmt.Println(u)

	raw.Extract("\nimport", ")\n").Last().ExtractQuote().MapWith(func(i int, item s.EStr) any {
		// return item.ANSIBold().ANSIUnderline().ANSIBlue()
		// raw[item.Start:item.End].ANSIGreen().Println()

		// return s.Str("{{IMPORT AREA}}").ANSISelected()
		return item.ANSIBold().ANSIUnderline().ANSIMagenta()
	}).Each(func(key s.Str, item2 any) {
		raw = raw.Replace(key.String(), item2.(s.Str).String())

		raw.StatusBar("show---")
		time.Sleep(1 * time.Second)

	})
	raw.ExtractQuote().Each(func(i int, item s.EStr) {
		raw = raw.Replace(item.String(), string(item.ANSISelected()))
		time.Sleep(1 * time.Second)
		raw.StatusBar("show no.2 second")
	})
	raw.ExtractQuote().Each(func(i int, item s.EStr) {
		raw[item.Start:item.End].ANSIYellow().Println()
	})
}
